<div class="setting com_width">
    <?php include PROJECT_PATH . 'Application/View/menu.tpl.php';?>
    <div class="menu_head"></div>
    <div class="right">
        <div class="userpassword">
            <div class="info">
                <span class="title">旧密码:</span>
                <input id="oldpassword" class="password text" type="password" value="" />
            </div>
            <div class="info">
                <span class="title">新密码:</span>
                <input id="newpassword" class="password text" type="password" value="" />
            </div>
            <div class="info">
                <span class="title_repassword">确认密码:</span>
                <input id="repassword" class="repassword text" type="password" value="" />
            </div>
            <div class="errmsg" id="errmsg"></div>
            <div class="info">
                <input id="userpassword" class="btn btn_input" style="margin-left:286px;" type="button" value="修 改">
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $("#oldpassword").focus();
    $("#userpassword").click(function (){
        $.ajax({
              url: "http://<?=HOST?>/user/doPassword",
              cache: false,
              timeout:10000,
              type: "POST",
              data: {
                  oldpassword:$("#oldpassword").val(),
                  newpassword:$("#newpassword").val(),
                  repassword:$("#repassword").val()
              },
              dataType: "json",
              beforeSend: function() {
                  disableHTML(true, '请稍等，处理中……', true);
              },
              success: function(data) {
                  if(data.errCode != 0){
                    disableHTML(true, data.errMsg, false);
                        setTimeout(disableHTML,2000);
                        $("#errmsg").text(data.errMsg);
                        $("#oldpassword").focus();
                  }else{
                    disableHTML(true, '处理成功，跳转中……', true);
                    setTimeout("location.href = 'http://<?=HOST?>/sign/in'",1000);
                  }
              },
              error:function(){
                disableHTML(true, "请求出错，请重试或联系管理员", false);
                setTimeout(disableHTML,2000);
            }
            });
    });
</script>
